package com.xjrsoft.module.customerTwo.barin.barinFunctionalSubassembly.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xjrsoft.core.tool.utils.StringUtil;
import com.xjrsoft.module.customerTwo.barin.barinFunctionalSubassembly.entity.TBarinFunctionalSubassembly;
import com.xjrsoft.module.customerTwo.barin.barinFunctionalSubassembly.dto.TBarinFunctionalSubassemblyListDto;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput;
import java.util.List;
import com.xjrsoft.module.customerTwo.barin.barinFunctionalSubassembly.mapper.TBarinFunctionalSubassemblyMapper;
import com.xjrsoft.module.customerTwo.barin.barinFunctionalSubassembly.service.ITBarinFunctionalSubassemblyService;
import com.xjrsoft.core.mp.base.BaseService;
import com.xjrsoft.core.tool.utils.Func;
import com.xjrsoft.module.customerTwo.barin.barinFunctionalSubassembly.vo.TBarinFunctionalSubassemblyListVo;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;

/**
 *  服务实现类
 *
 * @author dongxinhang
 * @since 2024-04-25
 */
@Service
@AllArgsConstructor
public class TBarinFunctionalSubassemblyServiceImpl extends BaseService<TBarinFunctionalSubassemblyMapper, TBarinFunctionalSubassembly> implements ITBarinFunctionalSubassemblyService {


	@Override
	public IPage<TBarinFunctionalSubassembly> getPageList(TBarinFunctionalSubassemblyListDto pageListDto) {
		Wrapper<TBarinFunctionalSubassembly> wrapper = Wrappers.<TBarinFunctionalSubassembly>query().lambda()
				.like(!StringUtil.isBlank(pageListDto.getF_Name()), TBarinFunctionalSubassembly::getFName, pageListDto.getF_Name())
				.eq(!StringUtil.isBlank(pageListDto.getF_Type()), TBarinFunctionalSubassembly::getFType, pageListDto.getF_Type())
				.eq(!StringUtil.isBlank(pageListDto.getF_Class()), TBarinFunctionalSubassembly::getFClass, pageListDto.getF_Class())
				.eq(!StringUtil.isBlank(pageListDto.getF_Status()), TBarinFunctionalSubassembly::getFStatus, pageListDto.getF_Status())
				.eq(!StringUtil.isBlank(pageListDto.getF_MerchantId()), TBarinFunctionalSubassembly::getFMerchantid, pageListDto.getF_MerchantId());
		return this.page(ConventPage.getPage(pageListDto), wrapper);
	}

	@Override
	public boolean addTBarinFunctionalSubassembly(TBarinFunctionalSubassembly tBarinFunctionalSubassembly) {
		boolean isSuccess = this.save(tBarinFunctionalSubassembly);
		return isSuccess;
	}

	@Override
	public boolean updateTBarinFunctionalSubassembly(String id, TBarinFunctionalSubassembly tBarinFunctionalSubassembly) {
		tBarinFunctionalSubassembly.setFId(id);
		return this.updateById(tBarinFunctionalSubassembly);
	}

	public boolean delete(String ids) {
		List<String> idList = Func.toStrList(ids);
		if (this.removeByIds(idList)) {
			return true;
		}
		return false;
	}

	@Override
	public IPage<TBarinFunctionalSubassemblyListVo> portalSearch(Page page, TBarinFunctionalSubassemblyListDto dto) {
		return this.getBaseMapper().portalSearch(page,dto);
	}


}